<?php 
	//initialize the session
session_start(); 
require_once('Connections/db.php');

mysql_select_db($database_db, $db);
$query_qryliq = "select * from `liquidaciones` l where l.`id_liquidacion` = ".$_GET['idliq'];
//echo $query_qryliq;
$qryliq = mysql_query($query_qryliq, $db) or die(mysql_error());
$row_qryliq = mysql_fetch_assoc($qryliq);

mysql_select_db($database_db, $db);
$updliq_sql = "update solicitud_servicios 
				set anio_liquidacion = null, nro_liquidacion = null, fecha_liquidacion = null 
				where anio_liquidacion = ".$row_qryliq['anio']." and nro_liquidacion = ".$row_qryliq['nro_liquidacion'];
//echo $updliq_sql;
$updliq = mysql_query($updliq_sql, $db) or die(mysql_error());

$hoy=getdate(); 

		//audito
		mysql_select_db($database_db, $db);  
		$qaudito_liq = "Insert into liquidaciones_h ( id_liquidacion, accion, fecha_hora, usuario) 
						   values ( ".$_GET['idliq'].", 1, NOW(), '".$_SESSION['MM_Username']."')";
		$audito_liq = mysql_query($qaudito_liq, $db) or die(mysql_error());
		//fin audito
		
mysql_select_db($database_db, $db);
$updliq_sql = "update liquidaciones 
				set fecha_anulacion = '".$hoy['year']."-".$hoy['mon']."-".$hoy['mday']."' 
				where id_liquidacion = ".$_GET['idliq'];
//echo $updliq_sql;
$updliq = mysql_query($updliq_sql, $db) or die(mysql_error());

header("Location: liq_anular.php?correcto=1");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>
